package user_shop

import (
	"context"
	"fmt"
	user2 "goods-rpc/internal/server/user-shop"
	"goods-rpc/pkg"
	users "goods-rpc/proto/user"
	"time"
)

type UserRpcService struct {
	users.UnimplementedUsersServer
}

func (l *UserRpcService) UserLogin(ctx context.Context, req *users.UserLoginReq) (*users.UserLoginResp, error) {
	loginOne, err := user2.TakeLoginOne(req.TextOne)
	if err != nil {
		return nil, err
	}
	fmt.Println(loginOne)
	jwtToken, err := pkg.GetJwtToken("tttttttttttttttttt", time.Now().Unix(), 86400, "123123")
	if err != nil {
		return nil, err
	}
	return &users.UserLoginResp{
		JwtToken: jwtToken,
		TextOne:  "ming",
		TextTow:  "123123",
	}, nil

}
